package com.shujia.gma.common

import scala.io.Source

object FlinkSqlRunner extends FlinkTool {
  override def run(args: Array[String]): Unit = {


    if (args.length == 0) {
      println("请指定sql文件的路径")
      return
    }

    val sqlFilePath = args(0)

    val sql: String = Source.fromFile(sqlFilePath)
      .getLines()
      .toList
      .mkString("\n")

    println(("#" * 50) + "正在执行的sql" + ("#" * 50))
    println(sql)
    println("#" * 110)


    bsTableEnv.executeSql(sql)
  }
}
